Add readBinaryWithFeatures to JS API#8541
Conversation
| binaryen.setDebugInfo(false); | ||
| module.dispose(); | ||
|
|
||
| module = binaryen.readBinaryWithFeatures(buffer, features); |
There was a problem hiding this comment.
Would it make sense to test the failing case here where we don't have the features?
…ures are not enabled
spotandjake
left a comment
There was a problem hiding this comment.
This looks good to me.
|
If it's not too late (I see this is merged), another option might be to add this to the existing readBinary(), that is, add a second param on line 3308? If the param is undefined, we can set it to MVP features. I guess the larger question is, do we want to mirror the C API, or do something more JS-ey with optional parameters. We do already use the check-for-undefined pattern elsewhere, so I lean towards that, but don't feel strongly. |
|
Oh yeah, that's a good idea 😅 |
|
Does that sound reasonable to you too @ospencer @spotandjake ? If so I can open a PR. |
|
I don't think it's a bad idea, but it might be a little confusing, maybe. I'd expect |
|
Hmm, yeah, good point, enabling all features would be more natural here. But we use MVP features in the original version in the C API for backwards compatibility, so the C and JS APIs would mismatch if we did that. Maybe it's not worth changing anything, given that. |
Realized this was missing when I tried to reach for it.